package com.sakiko.aspects;

import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

// todo: aop_02
@Component
@Aspect
public class TxAspect {

    @Before("execution(* com.sakiko.aop_02.impl.*.*(..))")
    public void beginTransaction(){
        System.out.println("begin transaction...");
    }

    @AfterReturning("execution(* com.sakiko.aop_02.impl.*.*(..))")
    public void commitTransaction() {
        System.out.println("commit transaction...");
    }

    @AfterThrowing("execution(* com.sakiko.aop_02.impl.*.*(..))")
    public void rollbackTransaction() {
        System.out.println("rollback transaction...");
    }
}
